package com.lenovo.manufacture.module;

import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.beardedhen.androidbootstrap.BootstrapEditText;
import com.beardedhen.androidbootstrap.BootstrapLabel;
import com.beardedhen.androidbootstrap.BootstrapText;
import com.lenovo.manufacture.R;
import com.lenovo.manufacture.net.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class module6 extends BaseActivity {

    @BindView(R.id.m6_tv)
    BootstrapLabel m6Tv;
    @BindView(R.id.m6_et1)
    BootstrapEditText m6Et1;
    @BindView(R.id.m6_et2)
    BootstrapEditText m6Et2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_module6);
        ButterKnife.bind(this);
        init();
    }

    private void init() {
        json.put("id", 1);
        async(data.FactoryInfo(json), v -> m6Tv.setBootstrapText(new BootstrapText.Builder(this).addText("工厂资金："+v.getData().get(0).get("gold")).build()));
    }

    @OnClick(R.id.m6_bt)
    public void onViewClicked() {
        String s1 = m6Et1.getText().toString();
        String s2 = m6Et2.getText().toString();
        if (!s1.equals("") && !s2.equals("")) {
            json.put("userLineId", s1);
            json.put("supplyListId", s2);
            json.put("num", 1);
            async(data.addmaterial(json), v -> {
                showMsg("购买成功");
                init();
            });
        } else showMsg("请输入完整");
    }
}